package com.czz.manage.controller.admin;

import com.czz.common.vo.R;
import com.czz.manage.service.DashBoardService;
import com.czz.manage.vo.DashBoardVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @ClassName: DashBoardAdminController
 * @Author Czz
 * @Date 2020/2/18
 * @Time 13:20
 **/
@RestController
@RequestMapping(value = "/admin/dashboard")
public class DashBoardAdminController {

    @Autowired
    DashBoardService dashBoardService;

    /**
    * @Description 管理员首页信息
    * @Param []
    * @Return com.czz.common.vo.R
    * @Author Czz
    * @Date 2020/2/18
    * @Time 15:12
    **/
    @GetMapping(value = "")
    public R getAdminDashBoardData(){
        DashBoardVo dashBoardVo = dashBoardService.getAdminDashBoardData();
        return R.ok().data("item",dashBoardVo);
    }

    /**
    * @Description 获取echarts数据
    * @Param []
    * @Return com.czz.common.vo.R
    * @Author Czz
    * @Date 2020/2/18
    * @Time 17:26
    **/
    @GetMapping(value = "/chart")
    public R getAdminChartData(){
        Map<String,Object> map = dashBoardService.getAdminChartData();
        return R.ok().data("item",map);
    }
}
